package com.zxcrm.web.controller.zxcrm;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zxcrm.common.annotation.Log;
import com.zxcrm.common.core.controller.BaseController;
import com.zxcrm.common.core.domain.AjaxResult;
import com.zxcrm.common.enums.BusinessType;
import com.zxcrm.zxcrm.domain.ZxcrmScoreEvaluate;
import com.zxcrm.zxcrm.service.IZxcrmScoreEvaluateService;
import com.zxcrm.common.utils.poi.ExcelUtil;
import com.zxcrm.common.core.page.TableDataInfo;

/**
 * 评分与评价规则表Controller
 * 
 * @author xu
 * @date 2025-07-17
 */
@RestController
@RequestMapping("/zxcrm/scoreEvaluate")
public class ZxcrmScoreEvaluateController extends BaseController
{
    @Autowired
    private IZxcrmScoreEvaluateService zxcrmScoreEvaluateService;

    /**
     * 查询评分与评价规则表列表
     */
    @PreAuthorize("@ss.hasPermi('zxcrm:scoreEvaluate:list')")
    @GetMapping("/list")
    public TableDataInfo list(ZxcrmScoreEvaluate zxcrmScoreEvaluate)
    {
        startPage();
        List<ZxcrmScoreEvaluate> list = zxcrmScoreEvaluateService.selectZxcrmScoreEvaluateList(zxcrmScoreEvaluate);
        return getDataTable(list);
    }

    /**
     * 导出评分与评价规则表列表
     */
    @PreAuthorize("@ss.hasPermi('zxcrm:scoreEvaluate:export')")
    @Log(title = "评分与评价规则表", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ZxcrmScoreEvaluate zxcrmScoreEvaluate)
    {
        List<ZxcrmScoreEvaluate> list = zxcrmScoreEvaluateService.selectZxcrmScoreEvaluateList(zxcrmScoreEvaluate);
        ExcelUtil<ZxcrmScoreEvaluate> util = new ExcelUtil<ZxcrmScoreEvaluate>(ZxcrmScoreEvaluate.class);
        util.exportExcel(response, list, "评分与评价规则表数据");
    }

    /**
     * 获取评分与评价规则表详细信息
     */
    @PreAuthorize("@ss.hasPermi('zxcrm:scoreEvaluate:query')")
    @GetMapping(value = "/{scoreId}")
    public AjaxResult getInfo(@PathVariable("scoreId") Long scoreId)
    {
        return success(zxcrmScoreEvaluateService.selectZxcrmScoreEvaluateByScoreId(scoreId));
    }

    /**
     * 新增评分与评价规则表
     */
    @PreAuthorize("@ss.hasPermi('zxcrm:scoreEvaluate:add')")
    @Log(title = "评分与评价规则表", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ZxcrmScoreEvaluate zxcrmScoreEvaluate)
    {
        return toAjax(zxcrmScoreEvaluateService.insertZxcrmScoreEvaluate(zxcrmScoreEvaluate));
    }

    /**
     * 修改评分与评价规则表
     */
    @PreAuthorize("@ss.hasPermi('zxcrm:scoreEvaluate:edit')")
    @Log(title = "评分与评价规则表", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ZxcrmScoreEvaluate zxcrmScoreEvaluate)
    {
        return toAjax(zxcrmScoreEvaluateService.updateZxcrmScoreEvaluate(zxcrmScoreEvaluate));
    }

    /**
     * 删除评分与评价规则表
     */
    @PreAuthorize("@ss.hasPermi('zxcrm:scoreEvaluate:remove')")
    @Log(title = "评分与评价规则表", businessType = BusinessType.DELETE)
	@DeleteMapping("/{scoreIds}")
    public AjaxResult remove(@PathVariable Long[] scoreIds)
    {
        return toAjax(zxcrmScoreEvaluateService.deleteZxcrmScoreEvaluateByScoreIds(scoreIds));
    }
}
